let conf = require('../../app.config').app
let api = require('../../common/js/api')
const { tagOperation } = require('../../common/js/utils.js')
const app = getApp();

// develop 开发版 | trial 体验版 | release 正式版
const accountInfo = wx.getAccountInfoSync()
// 设置 CDN 地址
const cdn = conf[accountInfo.miniProgram.envVersion.toLowerCase()].cdn

Component({
  properties: {
    selected: {
      type: Number,
      value: -1
    }
  },
  data: {
    color: "#d2d2d2",
    selectedColor: "#000",
    list: [{
      "pagePath": "/pages/home/home",
      "iconPath": cdn + "/v24/tabbar1-no.png",
      "selectedIconPath": cdn + "/v24/tabbar1.png",
      "text": "首页"
    },
    {
      "pagePath": "/pages/staff/staff",
      "iconPath": cdn + "/v24/tabbar2-no.png",
      "selectedIconPath": cdn + "/v24/tabbar2.png",
      "text": "营养师"
    },
    {
      "pagePath": "/pages/store/store",
      "iconPath": cdn + "/v24/tabbar3-no.png",
      "selectedIconPath": cdn + "/v24/tabbar3.png",
      "text": "积分商城"
    },
    {
      "pagePath": "/pages/client/client",
      "iconPath": cdn + "/v24/tabbar4-no.png",
      "selectedIconPath": cdn + "/v24/tabbar4.png",
      "text": "我的"
    },
    ]
  },
  attached() { },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      if (url == '/pages/client/client') {
        /*
        wx.requestSubscribeMessage({
          tmplIds: ["vUCAXpjImMVfwxPDJ-_0GUQsZut9nIWp5nA388ppsNc"],
          success: res => {
            api.interface.userSubscribeMessage({ type: 4 });
          },
          complete() {
            wx.redirectTo({ url })
          }
        })

         */
        wx.redirectTo({ url })
      } else {
        wx.redirectTo({ url })
      }
    }
  }
})